﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MiniErp.Entity.DataStreams.DOs.AssetManagement;
using MiniErp.Entity.DataStreams.DTOs.AssetManagement;
using MiniErp.Service.BusinessService.IService.AssetManagement;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace MiniErp.Core.Controllers.AssetManagement
{
    /// <summary>
    /// 资产管理记录控制层
    /// </summary>
    [Route("AssetIndex")]
    public class AssetRecordController : ApiControllers
    {
        private readonly IAssetRecordService _assetRecordService;
        public AssetRecordController(IAssetRecordService assetRecordService)
        {
            _assetRecordService = assetRecordService;
        }

        /// <summary>
        /// 查询指定时间段的数据   //分页
        /// </summary>
        /// <param name="startTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <param name="Page">页码</param>
        /// <param name="num">每页数据条数</param>
        [HttpGet]
        [Route("GetAllRecordAsync")]
        public Task<List<AssetModificationRecordDTO>> GetAllRecordAsync(DateTime startTime, DateTime endTime, int Page, int num)
        {
            return _assetRecordService.GetAllRecordAsync(startTime, endTime, Page, num);
        }

        /// <summary>
        /// 模糊查询指定时间段的数据   //分页
        /// </summary>
        /// <param name="value">模糊查询值</param>
        /// <param name="startTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <param name="Page">页码</param>
        /// <param name="num">每页数据条数</param>
        [HttpGet]
        [Route("GetFuzzyRecordAsync")]
        public Task<List<AssetModificationRecordDTO>> GetFuzzyRecordAsync(string value, DateTime startTime, DateTime endTime, int Page, int num)
        {
            return _assetRecordService.GetFuzzyRecordAsync(value, startTime, endTime, Page, num);
        }



    }
}
